package SwingProbe;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.net.InetAddress;
import javax.swing.JPanel;

public class PaintPanel extends JPanel
{

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        Graphics2D g2d = (Graphics2D) g;

        String IP = "";
        try {
            IP = InetAddress.getLocalHost().getHostAddress();
        }
        catch (Exception e) {
            IP = "Error finding IP";
        }
        Font font = new Font(IP, Font.BOLD, 15);
        g2d.setColor(Color.darkGray);
        g2d.setFont(font);
        g2d.drawString(IP, 40, 40);
        Rectangle2D r = new Rectangle2D.Double(30, 20, 115, 30);
        g2d.setColor(Color.LIGHT_GRAY);
        g2d.setBackground(Color.GREEN);
        g2d.draw(r);

    }

}
